import request from '@/utils/http'


export function saveCampaign(campaign) {

    const queryData = campaign
    return request(
         '/api/campaign/save', queryData, 'post'
    )
}

export function apiGetAllCampaign(params) {
    params.limit = 12
    params.sidx = 'id'
    params.order = 'asc'
    return request('/api/campaign/list', params, 'get')
}


export function apiGetAllCampaignByCreate(params) {
    params.limit = 6
    params.sidx = 'create_time'
    params.order = 'desc'
    return request('/api/campaign/list', params, 'get')
}


export function apiGetAllCampaignByEnd(params) {
    params.limit = 6
    params.sidx = 'campaign_duration'
    params.order = 'asc'
    return request('/api/campaign/list', params, 'get')
}




export function queryCampaignByUID(params) {
    params.page = 1
    params.limit = 6

    return request(
        '/api/campaign/listByUID', params, 'post', false
    )
}


export async function queryCampaignInfoByID(cid) {

    return request(
        '/api/campaign/info/' + cid,  {}, 'get'
    )
}


export function deleteCampaignByID(cid) {

    return request(
        '/api/campaign/deleteById/' + cid,  {}, 'get'
    )
}


export function apiGetAllCampaignByContent(content) {
    var params = {}
    params.pageId = 6
    params.pageSize = 10
    params.content = content
    return request('/api/campaign/queryContent', params)
}





